package org.example.traffic.studentAccount;

import org.example.traffic.student.Student;
import org.example.traffic.student.StudentRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
@Transactional
public class StudentAccountService {
    @Autowired
    private  StudentAccountRepository studentAccountRepository;

    @Autowired
    private  StudentRepository studentRepository;

    public StudentAccount getStudentAccount(StudentAccount studentAccount ) {
        String phone = studentAccount.getUsername();
        System.out.println(phone);
        Student student = studentRepository.findByPhone(phone);
        System.out.println(student);
        studentAccount.setStudent(student);
        return studentAccount;
    }
}
